<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head />
    <h:body>
        <ui:composition template="template.xhtml">
            
            <ui:define name="title">
                Notifications
            </ui:define>
            
            <ui:define name="content">
                <!--______________ MAIN CONTENT ______________-->
                <h:form>
                    <p:dataTable value="#{notificationBean.notification}" var="o"
                                 styleClass="order-table"
                                 rendered="#{(notificationBean.notification.size()>0)==true}"
                                 >
                        <f:facet name="header">
                            Notifications
                        </f:facet>
                        <p:column headerText="Event Name">
                                        #{o.relatedEvent.name}
                        </p:column>
                                        
                        <p:column headerText="Organizer Name">
                                        #{o.relatedEvent.organizer.name}
                        </p:column>
                                        
                        <p:column headerText="Organizer Surname">
                                        #{o.relatedEvent.organizer.surname}
                        </p:column>
                                        
                        <p:column headerText="Type">
                                        #{o.type}
                        </p:column>
                                        
                        <p:column headerText="Generation Date">
                                        #{o.generationDate}
                        </p:column>
                                        
                        <p:column headerText="Seen">
                                        #{o.seen}
                        </p:column>
                                        
                        <p:column headerText="See Related Event">
                            <h:commandLink value="View Event" action="#{notificationBean.showEventRelatedToNotification(o)}" />
                        </p:column>
                                        
                        <p:column headerText="Delete Notification">
                            <h:commandButton value="Delete" action="#{notificationBean.deleteNotification(o)}" />
                        </p:column>
                    </p:dataTable>
                    <h:outputLabel value="There are no notifications to display" rendered="#{(notificationBean.notification.size()>0)==false}">
                    </h:outputLabel> 
                </h:form>
                <br>   
                </br>
            </ui:define>
            
        </ui:composition>
    </h:body>
</html>

